from selenium import webdriver
import openpyxl
import pyautogui
import time
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_experimental_option("prefs", {"profile.password_manager_enabled": False, "credentials_enable_service": False})
PATH= "C:/Users/user/Desktop/chromedriver_win32/chromedriver.exe"
driver=webdriver.Chrome(PATH,chrome_options=options)
driver.get('https://www.google.com/')
driver.maximize_window()
workbook=openpyxl.load_workbook(filename='77老大.xlsx')
sheet=workbook['工作表1']
for i in range(1,2):
cell=sheet.cell(row=i,column=5).value
print(cell)
driver.get(cell)
time.sleep(1)
views=driver.find_elements_by_xpath("//*[@id='count']/ytd-video-view-count-renderer/span[1]")
date=driver.find_elements_by_xpath("//*[@id='info-strings']/yt-formatted-string")
likes=driver.find_elements_by_class_name("style-scope ytd-toggle-button-renderer.style-text")
#dislikes=driver.find_elements_by_xpath("//*[@id='text']")
messages=driver.find_elements_by_class_name("style-scope yt-formatted-string")
long=driver.find_elements_by_class_name('ytp-time-duration')
for element in views:
print('views:')
print(element.text)
for element in date:
print('date:')
print(element.text)
for element in likes:
print('likes:')
print(element.text)
for element in messages:
print('messages:')
print(element.text)
for element in long:
print('long:')
print(element.text)
```